package com.zr.daoImpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import com.zr.dao.XiugaiDao;
import com.zr.util.JDBCUtil;

public class XiugaiDaoImpl implements XiugaiDao{

	@Override
	public boolean getxiugai(String ename,int eage,String esex,String eidcard,String eborn,String enation,String eaddress,
    		String eeducation,int eid) {
		boolean b=false;
		StringBuffer sql=new StringBuffer("update employee INNER JOIN  department ON employee.did=department.did  ");
		sql.append(" set  ename=?,eage=?,esex=?,eidcard=?,eborn=?,enation=?,eaddress=?,");
		sql.append(" eeducation=? where eid=?");
		Connection con=JDBCUtil.getConnection();
		try {
			PreparedStatement pst=con.prepareStatement(sql.toString());
			pst.setString(1, ename);
			pst.setInt(2, eage);
			pst.setString(3, esex);
			pst.setString(4, eidcard);
			pst.setString(5, eborn);
			pst.setString(6, enation);
			pst.setString(7, eaddress);
			pst.setString(8, eeducation);
			pst.setInt(9, eid);
			
			int i=pst.executeUpdate();
			if(i>0){
				b=true;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return b;
	}
      
}
